package com.meida.module.system.provider.controller;

import com.meida.common.mybatis.model.*;
import com.meida.common.springmvc.base.BaseController;
import com.meida.module.system.client.entity.SysVersion;
import com.meida.module.system.provider.service.SysVersionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Map;


/**
 * APP版本升级
 *
 * @author flyme
 * @date 2019-10-19
 */
@RestController
@RequestMapping("/version/")
@Api(tags = "版本升级")
public class SysVersionController extends BaseController<SysVersionService, SysVersion> {

    @ApiOperation(value = "版本升级-分页列表", notes = "版本升级分页列表 ")
    @GetMapping(value = "page")
    @ApiIgnore
    public ResultBody page(@ModelAttribute(value = "pageModel") PageModel pageModel) {
        return bizService.pageList(pageModel);
    }

    @ApiOperation(value = "版本升级-列表", notes = "版本升级列表 ")
    @GetMapping(value = "list")
    @ApiIgnore
    public ResultBody list(@ModelAttribute(value = "listModel") ListModel listModel) {
        return bizService.listEntityMap(listModel);
    }

    @ApiOperation(value = "版本升级-添加", notes = "添加版本升级")
    @PostMapping(value = "save")
    @ApiIgnore
    public ResultBody save(@ModelAttribute(value = "updateModel") SaveModel saveModel) {
        return bizService.add(saveModel);
    }

    @ApiOperation(value = "版本升级-更新", notes = "更新版本升级")
    @PostMapping(value = "update")
    @ApiIgnore
    public ResultBody update(@ModelAttribute(value = "updateModel") UpdateModel updateModel) {
        return bizService.edit(updateModel);
    }

    @ApiOperation(value = "版本升级-删除", notes = "删除版本升级")
    @PostMapping(value = "delete")
    @ApiIgnore
    public ResultBody delete(@ModelAttribute(value = "deleteModel") DeleteModel deleteModel) {
        return bizService.delete(deleteModel);
    }

    @ApiOperation(value = "版本升级接口", notes = "版本升级接口")
    @GetMapping(value = "getByCode")
    public ResultBody get(@RequestParam(value = "verCode") String verCode) {
        return bizService.getByVeCode(verCode);
    }

    @ApiOperation(value = "详情接口", notes = "详情")
    @GetMapping(value = "get")
    public ResultBody get(@RequestParam(required = false) Map params) {
        return bizService.get(params);
    }

}
